import React from "react";
import routeWithUserSession from "@/components/ApplicationArea/routeWithUserSession";
import PageHeader from "@/components/PageHeader";
import TabletypeToolbar from "@/components/workflow/TabletypeToolbar";
import routes from "@/services/routes";
class TabletypeNew extends React.Component {

  state = {
    items:[],//{
       id: "0",
    loading: true,
  };
  componentWillMount() {
    // var len = document.body.classList;
    // console.log(len);
    //  console.log(this.props);//val值
    // console.log(this.props.history.location.state);
    // console.log(this.props.location.state);
    // console.log(this.pageProps);
    let id;
    if(this.props.id===undefined){
      id=0;
    }else{
      id=this.props.id;//this.props.location.state.id;
    }
      this.setState({
            id: id,
            loading: false,
      });
    // timestruct.query('0').then(data => {
    //   this.setState({
    //         items: data,
    //         loading: false,
    //   });
    // });
    //this.refreshData();
  }

  render() {
    if (this.state.loading ) return null;
    return (
      <div className="settings-screen">
        <div className="container">
          <PageHeader title="单据类型" />
            <div className="p-15">
              <TabletypeToolbar  id={this.state.id} />
            </div>
        </div>
      </div>
    );
  }
}

routes.register(
  "Tabletype.New",
  routeWithUserSession({
    path: "/tabletype/new/:id",
    title: "单据类型",
    render: pageProps => <TabletypeNew {...pageProps}/>,
  })
);
// export default [
//   routeWithUserSession({
//     path: "/tabletype/new/:id",
//     title: "单据类型",
//     render: pageProps => <TabletypeNew {...pageProps} />,
//   }),
// ];
